﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using HotelManagement.PL;

namespace HotelManagement
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //open program only one
            if (System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess().ProcessName).Length > 1)
            {
                MessageBox.Show("ERROR", "程序已经运行", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Application.Exit();
                return;
            }

            Form loginForm = new LoginForm();
            if (loginForm.ShowDialog() == DialogResult.OK) 
            {
                Application.Run(new MainForm());
            }
            //Application.Run(new LoginForm());
        }
    }
}
